package com.iwhalecloud.uncc.common;

import com.iwhalecloud.uncc.properties.UnccDsProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zq
 * @date 2021/10/21 15:20
 * @description DataSourceHelp
 */
@Component
@Slf4j
public class DataSourceHelp {

    @Autowired
    private UnccDsProperties unccDsProperties;

    public List<UnccDsProperties.UnccDsConfig> getOnlineDatasource() {
        return unccDsProperties.getBizDatasource().stream()
                .filter(i -> !i.getCode().startsWith(ArchiverConstant.HIS))
                .collect(Collectors.toList());
    }
}
